<template>
  <h2>自定义hook函数</h2>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import useRequest from "./hooks/useRequest";
// 接口 约束数据类型
interface AddressData {
  id: number;
  address: string;
  name: string;
}

interface UserInfo {
  id: number;
  age: number;
  name: string;
}
export default defineComponent({
  name: "App",
  setup() {
    // const { isLoading, data, errorMsg } = useRequest<AddressData>("");
    const { isLoading, data, errorMsg } = useRequest<UserInfo[]>("");
    return { isLoading, data, errorMsg };
  },
});
</script>

<style>
</style>
